package c2.advanced.business.base;

import c2.advanced.share.DbFacade;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class KvDao extends AdvDaoTemplate {

    private static final String COLLECTION = "kv";

    public KvDao(DbFacade root) {
        super(root);
    }

    public <T extends KvData> T getByKey(String key, Class<T> dataClz) {
        return mongo().findById(key, dataClz, COLLECTION);
    }

    public <T extends KvData> T save(T data) {
        return mongo().save(data, COLLECTION);
    }

}